﻿<Window x:Class="RL.wRouteList"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Журнал путевых листов" Height="300" Width="786" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:my="clr-namespace:RL" xmlns:scm="clr-namespace:System.ComponentModel;assembly=System" Loaded="Window_Loaded" Closing="Window_Closing">
    <Window.Resources>
        <CollectionViewSource x:Key="routeListViewSource" d:DesignSource="{d:DesignInstance my:RouteList, CreateList=True}" >
        </CollectionViewSource>
        <my:DriverIDConverter x:Key="DriverIDConverter"/>
        <my:VehicleIDConverter x:Key="VehicleIDConverter" />
    </Window.Resources>
    <Grid DataContext="{StaticResource routeListViewSource}">
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition />
            <RowDefinition Height="35"/>
        </Grid.RowDefinitions>
        <StackPanel Name="stackPanel1" Orientation="Horizontal">
            <Button Content="Добавить" Height="23" Name="buttonAdd" Width="75" Click="buttonAdd_Click"/>
            <Button Content="Удалить" Height="23" Name="buttonDelete" Width="75" Click="buttonDelete_Click" />
            <Button Content="Редактировать" Height="23" Name="buttonEdit" Width="97" Click="buttonEdit_Click"/>
            <Button Content="Сохранить" Height="23" Name="buttonSave" Width="75" Click="buttonSave_Click"/>
            <Button Content="Печать" Height="23" Name="buttonPrint" Width="75" Click="buttonPrint_Click"/>
            <my:ucSelectRLByNumber Grid.Column="1" Grid.Row="2" x:Name="FindRL" Width="267" />
            <Button Content="Найти" Height="23" Name="buttonFind" Width="75" Click="buttonFind_Click" />
        </StackPanel>
        <DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" Grid.Row="1" ItemsSource="{Binding}" Name="routeListDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" CanUserAddRows="False" CanUserDeleteRows="False">
            <DataGrid.Columns>
                <DataGridTextColumn x:Name="nomdogColumn" Binding="{Binding Path=nomdog}" Header="Номер" Width="100" IsReadOnly="True" />
                <!--<DataGridTextColumn x:Name="datedocColumn" Binding="{Binding Path=datedoc}" Header="Дата" Width="100" IsReadOnly="True" />-->
                <DataGridTextColumn x:Name="datedocColumn" Binding="{Binding Path=dt_datedoc, StringFormat='dd/MM/yyyy'}" Header="Дата" Width="100" IsReadOnly="True" />
                <DataGridTextColumn x:Name="nomdepartureColumn" Binding="{Binding Path=nomdeparture}" Header="Выход" Width="60" IsReadOnly="True" />
                <!--<DataGridTextColumn x:Name="id_driverColumn" Binding="{Binding Path=id_driver}" Header="Водитель" Width="200" />-->
                <DataGridTextColumn x:Name="id_driverColumn" Binding="{Binding Path=id_driver, Converter={StaticResource DriverIDConverter}}" Header="Водитель" Width="200" IsReadOnly="True" />
                <!--<DataGridTextColumn x:Name="id_vehicleColumn" Binding="{Binding Path=id_vehicle}" Header="ТС" Width="150" />-->
                <DataGridTextColumn x:Name="id_vehicleColumn" Binding="{Binding Path=id_vehicle, Converter={StaticResource VehicleIDConverter}}" Header="ТС" Width="150" IsReadOnly="True" />
                
            </DataGrid.Columns>
        </DataGrid>
        <StackPanel Grid.Row="2" Name="stackPanel2" Orientation="Horizontal">
            <Button Content="Выбрать" Height="23" Name="buttonSelect" Width="75" Click="buttonSelect_Click"/>
        </StackPanel>
    </Grid>
</Window>
